package com.atguigu.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
 * @Description 用户的实体类
 */
@Data
@TableName("user")
public class User implements Serializable {

    public static final Long serialVersion = 1L;

    @TableId(type = IdType.AUTO)
    @JsonProperty("user_id")    //jackson注解，用来格式化属性， 只能接收 user_id
    private Integer userId;

    @Length(min = 4)
    private String  userName;

    @JsonInclude(JsonInclude.Include.NON_NULL)  //当这个值为null时不生成json，不为null时生成json，不影响接收json
    @NotBlank
    private String  password;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @NotBlank
    private String  userPhonenumber;

}
